chore: update attachment types to include selection support#223
Closed
SilentDemonSD wants to merge 3 commits intogithub:mainfrom
Closed
chore: update attachment types to include selection support#223SilentDemonSD wants to merge 3 commits intogithub:mainfrom
SilentDemonSD wants to merge 3 commits intogithub:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request updates the Node.js and Python SDK attachment type definitions to support a new selection attachment shape consistent with the generated session_events types, and adds Python tests for session event/attachment parsing.
Changes:
- Node.js: Extend
MessageOptions.attachmentsto supportselectionattachments withfilePath,displayName, optionalselectionrange, and optionaltext, and tightenfile/directoryattachment typing. - Python: Introduce
SelectionRange,Selection, and discriminatedFileAttachment/DirectoryAttachment/SelectionAttachmentTypedDicts, withAttachmentas their union, and wire them intoMessageOptions. - Python: Add
test_session_events.pyto validate generatedSessionEventTypeenum values andAttachment.from_dictparsing forfile,directory, andselectionattachments.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
nodejs/src/types.ts |
Extends MessageOptions.attachments to a discriminated union including selection attachments and makes displayName required for file and directory. |
python/copilot/types.py |
Defines typed selection structures and discriminated attachment TypedDicts, updates Attachment to a union, and connects them to MessageOptions.attachments. |
python/test_session_events.py |
Adds unit tests that exercise generated SessionEventType values and Attachment.from_dict behavior for the new and existing attachment variants. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ing) Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Collaborator
|
Fixed on main! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Extended changes from : f902b76
What Changed
nodejs/src/types.tsselectionattachment type toMessageOptions.attachmentswithfilePath,displayName,selection?,text?fieldspython/copilot/types.pySelectionRange,Selection,FileAttachment,DirectoryAttachment,SelectionAttachmentTypedDicts; updatedAttachmentas union typepython/test_session_events.pyCompatibility
types.ts✅MessageOptionstypes.py✅[]Attachmentfrom generatedList<UserMessageDataAttachmentsItem>from generated3. Verification
pytest test_session_events.py→ 7 passedtsc --noEmit→ No errors